<?php

namespace app\admin\controller;

use think\Controller;
use think\Request;
use think\Db;
use think\Session;

class Login extends Admin
{
	public function login()
	{
		//加载登录页面
		return $this->fetch();
	}

	public function select()
    {
        $list = Request::instance()->post();
        $name = $list['name'];
       

        $data=Db::table('admininfo')->where('adminname',"$name")->value('password');
       
        if ($list['pass'] == $data) {
            Session::set('adminname',$name);
          

            return $this->success('登录成功!',url('admin/index/home'));
        } else {
            return $this->error('密码错误');
        }
    }

    public function quit()
    {
    	Session::set('adminname',null);
    	return $this->fetch('Login/login');
    }
}